from collections.abc import MutableMapping
from secrets import randbits


class Dict(MutableMapping):
    def __init__(self, dict_=None):
        self.node = {}
        self.RD = randbits(32)
        if dict_ is not None:
            self.update(dict)

    def __len__(self):
        return len(self.node)

    def __getitem__(self, key):
        if key ^ self.RD in self.node:
            return self.node[key ^ self.RD]
        raise KeyError(key)

    def __setitem__(self, key, item):
        self.node[key ^ self.RD] = item

    def __delitem__(self, key):
        del self.node[key ^ self.RD]

    def __iter__(self):
        return iter(self.node)

    def __contains__(self, key):
        return key ^ self.RD in self.node

    def __repr__(self):
        return repr({k ^ self.RD: v for k, v in self.node.items()})
